# _*_ coding : utf-8 _*_
# @Time : 2023/3/16 0016 18:58
# @Author : 菜鸟王小二
# @File : 23_bs4应用获取星巴克网站数据
# @Project : python爬虫

import urllib.request
from bs4 import BeautifulSoup

url = 'https://www.starbucks.com.cn/'

request = urllib.request.Request(url)

response = urllib.request.urlopen(request)

content = response.read().decode('utf-8')

# //div[@class="scroll"]//a//strong/text()   xpath获取数据

# BeautifulSoup()也可以获取服务器传过来的数据
soup = BeautifulSoup(content,'lxml')

obj = soup.select('div[class="scroll"] a strong')
print(obj)
for i in obj:
    # print(i.string)
    print(i.get_text())
